<div id='ServerSchedule' class="OneContainer">
	<div class="row">
		<div class="col-md-12 ">
			<div class="Panel PanelBlack">
				<div class="PanelTitle">服务器 {{servername}} 计划任务列表</div>
				<div class="PanelBody">
					<div class="row">
						<div class="col-sm-12 PanelItemF">
							<div class="PanelItem" v-on:click="toBackConsole()">
								<span class="glyphicon glyphicon-backward" aria-hidden="true"></span> 返回到控制台
							</div>
							<div class="PanelItem" v-on:click="toBackNew()">
								<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新建计划任务项目
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-lg-12">
							<p>欢迎您，{{username}}，这是本服务器的计划任务列表</p>
							<p>
								<b>凡是</b> __xxx__ 格式的命令均是内部命令，不影响使用，请勿乱使用，以防错误。
								<b>另外</b>，任务性质为 0 代表重复任务，不为 0 代表计次任务并且代表剩余计次数量。
							</p>
							<table class='PropertiesList' width="100%">
								<tr>
									<th class="PhoneDisplayNone">任务序号</th>
									<th>任务次数</th>
									<th>任务间隔</th>
									<th style="max-width: 120px;">任务指令</th>
									<th style="min-width: 94px;">操作</th>
								</tr>
								<tr v-for="obj in schedules" v-if="obj">
									<th v-text="obj.id" class="PhoneDisplayNone"></th>
									<th v-text="obj.count"></th>
									<th v-text="obj.time"></th>
									<th v-text="obj.commande"></th>
									<th style="min-width: 94px;">
										<a href="#" v-on:click="toSchedule(obj)">[ 配置 ]</a>
										&nbsp;&nbsp;
										<a href="#" v-on:click="toDelete(obj)">[ 删除 ]</a>
									</th>
								</tr>
							</table>
							<br />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>



<script>
	MI.rListener('onload', function () {
		MCSERVER.website.schedule = {};

		// 定义页面地址
		TOOLS.definePage('template/component/schedule', 'schedule/list', MCSERVER.listenServername);

		VIEW_MODEL.newVue('ServerSchedule', {
			el: '#ServerSchedule',
			methods: {
				toBackConsole: function () {
					RES.redirectPage('./template/component/console.html', 'server/console', this.servername);
				},
				toBackNew: function () {
					RES.redirectPage('./template/component/new_schedule.html', null);
				},
				toSchedule: function (obj) {
					MCSERVER.website.schedule.nowdata = obj;
					RES.redirectPage('./template/component/new_schedule.html', null);
				},
				toDelete: function (obj) {
					if (!confirm("您确定要删除这个计划任务吗？")) return;
					WS.sendMsg('schedule/delete', JSON.stringify({
						id: obj.id,
						servername: this.servername
					}), function () {
						PAGE.refresh();
					});
				}
			}
		});
	});

	MI.rListener('onend', function () {
		// VIEW_MODEL['ServerSchedule'] = null;
	});
</script>